import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/guider_home";
// 文章类型 1名导专访 2导游故事 3用户故事 4导游代言

export const get_favorite = (
  data: { type: number} & MiniApp.PagingQuery,
  showError = true
) => {
  return Http.get<MiniApp.PagingData>(`${baseUrl}/my/favorite`, data).catch(
    (error: Error) => {
      showError && delayTask(60, () => Toast.show(error.message));
      return Promise.reject(error);
    }
  );
};
export const get_favorite_type = ( showError = true) => {
  return Http.get<any>(`${baseUrl}/my/favorite_type`).catch(
    (error: Error) => {
      showError && delayTask(60, () => Toast.show(error.message));
      return Promise.reject(error);
    }
  );
};